/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package nominalitzacions.persistance;

import commonlib.domain.Corpus;
import java.io.FileNotFoundException;
import java.io.IOException;
import nominalitzacions.domain.Language;
import nominalitzacions.domain.NominalizatorDictionary;
import nominalitzacions.domain.UrlDomainController;

/**
 *
 * @author genis
 */
public class LanguageDataManagerController {

    private LanguageDataManager LDM;
    private NominalizatorDictionaryPersistanceController NDPC;
    private UrlDomainController UDC;
    private VerbCorpusPersistanceController VCPC;

    public LanguageDataManagerController() throws IOException {
        LDM = new LanguageDataManager();
        NDPC = new NominalizatorDictionaryPersistanceController();
        UDC = new UrlDomainController();
        VCPC = new VerbCorpusPersistanceController();
    }

    public void saveLanguage(String irrPath, String infPath,
             String nounsPath, String corpPath) throws IOException {
        LDM.saveLanguage(irrPath, infPath, nounsPath, corpPath);
    }
    /*
    public NominalizatorDictionary loadIrrDic(String langName) {
        return NDPC.loadDictionary(langName, "irregular");
    }

    public NominalizatorDictionary loadInfDic(String langName) {
        return NDPC.loadDictionary(langName, "infinitives");
    }

    public NominalizatorDictionary loadNounDic(String langName) {
        return NDPC.loadDictionary(langName, "nouns");
    }

    public Corpus loadCorpus(String langName) {
        return VCPC.loadCorpus(l);
    }*/

    public void saveVerb(String verb) throws IOException {
        LDM.saveVerb(verb);
    }
    
    public void deleteVerb(String verb) throws IOException {
        LDM.deleteVerb(verb);
    }

    public void savePair(String alpha, String beta) throws IOException {
        LDM.savePair(alpha, beta);
    }

    public void deletePair(String alpha, String beta) throws IOException {
        LDM.deletePair(alpha, beta);
    }

    public Language loadLanguage() throws FileNotFoundException, IOException {

        NominalizatorDictionary irr = NDPC.loadDictionary("irregulars");
        NominalizatorDictionary inf = NDPC.loadDictionary("infinitives");
        NominalizatorDictionary noun = NDPC.loadDictionary("nouns");
        Corpus corp = VCPC.loadCorpus(UDC.getLanguages());
        Language lang = new Language(inf, irr, noun, corp);
        return lang;

    }

    public void deleteLanguage(String langName) {
        LDM.deleteLanguage(langName);
    }

}
